package com.exam.scjp5.objectives.section_3;

import java.util.Scanner;

public class ExampleScanner
{
    public static void main(String args[])
    {
        String source = "text text 123 2.0 true false";
        Scanner scanner = new Scanner(source);
        while(scanner.hasNext())
        {
            if(scanner.hasNextInt())
                System.out.println("I : " + scanner.nextInt());
            else if(scanner.hasNextBoolean())
                System.out.println("B : " + scanner.nextBoolean());
            else if(scanner.hasNextDouble())
                System.out.println("D : " + scanner.nextDouble());
            else
                System.out.println("T : " + scanner.next());
        }
        
    }
}
